import time
import webbrowser

#Monday
alarm_hour_mon = 6
alarm_minute_mon = 45
#Tuesday
alarm_hour_tue = 7
alarm_minute_tue = 30
#Wednessday
alarm_hour_wed = 6
alarm_minute_wed = 00
#Thursday
alarm_hour_thu = 6
alarm_minute_thu = 00
#Friday
alarm_hour_fri = 6
alarm_minute_fri = 00
#URL to open
url = "http://radio.antfarm.co.za/cdn/clients/sabc/RSG/player.asp?id=65"    # RSG
#url = "http://www.ofm.co.za/listenlive"    # OFM
#url = "http://www.bbc.co.uk/radio/player/bbc_world_service" # BBC world service

print ("The current time is " + time.strftime("%d %B %Y %H:%M:%S", time.localtime()))
print ("The day is " + time.strftime("%A", time.localtime()))
print (" ")
print ("Alarms are set for:")
print ("Monday\t\t" + str(alarm_hour_mon) + ":" + "{0:0>2}".format(alarm_minute_mon).format(10))
print ("Tuesday\t\t" + str(alarm_hour_tue) + ":" + "{0:0>2}".format(alarm_minute_tue))
print ("Wednessday\t" + str(alarm_hour_wed) + ":" + "{0:0>2}".format(alarm_minute_wed))
print ("Thursday\t" + str(alarm_hour_thu) + ":" + "{0:0>2}".format(alarm_minute_thu))
print ("Friday\t\t" + str(alarm_hour_fri) + ":" + "{0:0>2}".format(alarm_minute_fri))

while (1):
    while(time.localtime()[6] == 0):    # Monday
        dt = list(time.localtime())
        hour = dt[3]
        minute = dt[4]
        if hour == alarm_hour_mon and minute == alarm_minute_mon:
            webbrowser.open(url)
            time.sleep(100)
        time.sleep(5)

    while(time.localtime()[6] == 1):    # Tuesday
        dt = list(time.localtime())
        hour = dt[3]
        minute = dt[4]
        if hour == alarm_hour_tue and minute == alarm_minute_tue:
            webbrowser.open(url)
            time.sleep(100)
        time.sleep(5)

    while(time.localtime()[6] == 2):    # Wednessday
        dt = list(time.localtime())
        hour = dt[3]
        minute = dt[4]
        if hour == alarm_hour_wed and minute == alarm_minute_wed:
            webbrowser.open(url)
            time.sleep(100)
        time.sleep(5)

    while(time.localtime()[6] == 3):    # Thursday
        dt = list(time.localtime())
        hour = dt[3]
        minute = dt[4]
        if hour == alarm_hour_thu and minute == alarm_minute_thu:
            webbrowser.open(url)
            time.sleep(100)
        time.sleep(5)

    while(time.localtime()[6] == 4):    #Friday
        dt = list(time.localtime())
        hour = dt[3]
        minute = dt[4]
        if hour == alarm_hour_fri and minute == alarm_minute_fri:
            webbrowser.open(url)
            time.sleep(100)
        time.sleep(5)

    while(time.localtime()[6] == 5 or time.localtime()[6] == 6 ):   # Saturday and Sunday
        time.sleep(3600)
